<template>
    <div>
        <el-header style="text-align: right; font-size: 15px">
            <span>
                欢迎使用学籍管理系统-学生基本信息
            </span>
        </el-header>
        <el-table
                :data="tableData"
                border
                style="width: 100%">
            <el-table-column
                    fixed
                    prop="s_id"
                    label="学号"
                    width="100">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_name"
                    label="姓名"
                    width="100%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_sex"
                    label="性别"
                    width="70%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_age"
                    label="年龄"
                    width="70%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_nation"
                    label="民族"
                    width="70%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_political"
                    label="政治面貌"
                    width="80%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_grade"
                    label="年级"
                    width="80%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_class"
                    label="班级"
                    width="80%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_area"
                    label="地区"
                    width="164%">
            </el-table-column>

            <el-table-column
                    fixed
                    prop="s_records"
                    label="奖惩记录"
                    width="100%">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="s_return"
                    label="休复转退标记"
                    width="110%">
            </el-table-column>
            <el-table-column
                    fixed
                    label="学历"
                    width="72">
                <template slot-scope="scope">
                    <el-button @click="look(scope.row)" type="text" size="small">查看</el-button>
                </template>
            </el-table-column>

        </el-table>
        <el-pagination
                background
                layout="prev, pager, next"
                page-size="9"
                :total="total"
                @current-change="page">
        </el-pagination>
    </div>
</template>

<script>
    export default {
        methods: {
                look(row){
                    this.$router.push({
                        path: '/Page3',
                        query:{
                            id:row.s_id
                        }
                    })
                },
                page(currentPage){
                    const _this = this
                    axios.get('http://localhost:8181/student/findAll/'+currentPage+'/9').then(function (resp) {
                        _this.tableData = resp.data.content
                        _this.total = resp.data.totalElements
                    })
                }
                },
                created() {
                    const _this = this
                    axios.get('http://localhost:8181/student/findAll/1/9').then(function (resp) {
                        _this.tableData = resp.data.content
                        _this.total = resp.data.totalElements
                    })
                },
                data() {
                    return {
                    total: null,
                    tableData: null
                }
            }
        }
</script>